package cl.xintec.utils
{
   
    import flash.display.Graphics;
    
    import mx.controls.DataGrid;
    import mx.controls.Label;
    import mx.controls.ToolTip;
    import mx.controls.dataGridClasses.*;
    import mx.controls.listClasses.*;    
    

    [Style(name="backgroundColor", type="uint", format="Color", inherit="no")]



    public class ResultadoLabel extends Label{

   //  	var arrayValor:ArrayOfCursor_valor_modificado=new ArrayOfCursor_valor_modificado;
     	    		
        private const POSITIVE_COLOR:uint = 0x000000; // Black
        private const NEGATIVE_COLOR:uint = 0xFF0000; // Red 

        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
            super.updateDisplayList(unscaledWidth, unscaledHeight);


				var g:Graphics = graphics;
				var str:String="";
				var str2:String="";
				var strID:String="";									
				var strColor:Number=0;				
				g.clear();
				if (listData != null)
				{
				var grid1:DataGrid = DataGrid(DataGridListData(listData).owner);
				str=DataGridListData(listData).dataField;
				str2=data["HIDE_" + str + "_FLAG"];
				strID=data["HIDE_" + str + "_ID"];				
			    this.toolTip="";
			    
					if (strID != null){
	                     if (data["HIDE_" + str + "_ID"].toString() == "-9999")
	                      {
	                    strColor= getStyle("backgroundColor");  	
						g.beginFill(new uint(strColor));
						g.drawRect(0, 0, unscaledWidth, unscaledHeight);
						g.endFill();
						setStyle("color", strColor);
						return;
	                      }
					}     
					
					                 
                     if ((data["HIDE_" + str + "_FLAG"] != 0) && (str2 != null) ){
			              setStyle("fontSize", 10);
						  setStyle("fontWeight", "bold");
						  setStyle("color", "0x000000");						  
					      return;	   
                        } else {
			              setStyle("fontSize", 10);
						  setStyle("fontWeight", "normal");
						  setStyle("color", "0x000000");						  
					      return;	   
                        	
                        }
                        

					if (str == "IFOLIO")
					{
						this.toolTip=  "Equipo = " + data["CEQUIPO"] + ", Sistema = " + data["CSISTEMA"] +
						":" + data["TDESCRIPCION_SIST"] +  ", OT = " + data["CORDEN_TRABAJO"];
						                
					}
                        
				}



        }
        
   /*     
      		 protected  function handleValor(event:Seap_pgrilla_valor_modificadoResultEvent):void {
				if (event.result != null) {
					var rs_Valor:Out_valor_modificado= event.result;
	            	arrayValor = rs_Valor.cursor_valor_modificado;
	            	
				   this.toolTip=data["HIDE_" + str + "_FLAG"] + " , " + data["HIDE_" + str + "_ID"];

				}
			}  
*/
        
    }

    
}



// ActionScript file






